package com.cd.form.jpa.domian;

import com.cd.common.domain.BaseDomain;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Index;
import javax.persistence.Table;

@Data
@Entity
@Table(name = "db_form_component",
        indexes = {
                @Index(name = "idx_form_form_id", columnList = "form_id")})
@NoArgsConstructor
@AllArgsConstructor
public class FormComponent extends BaseDomain {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
    private Long id;

    //场次
    @Column(name = "form_id")
    private Long formId;

    @Column(name = "name")
    private String name;

    //取值 取值为0时为不限制 其他值用逗号隔开
    @Column(name = "value")
    private String value;

    //类型 文本输入框 下拉框 还是图片上传 "type": "input", "radio", "checkbox", "file"
    @Column(name = "type")
    private String type;

    //是否必填
    @Column(name = "is_required")
    private Boolean isRequired;

    //排序
    @Column(name = "order_num")
    private Integer order;

}
